<%@ page import="databeans.*"%>
<%@ page import="helper.*"%>
<%Customer customer = (Customer)session.getAttribute("customer"); %>
<jsp:include page="../common/header.jsp" />


<title>Carnegie Financial Services - Buy Funds</title>
</head>

<body>
	<div id="container">
    	<div id="header">
        	<h2>Carnegie Financial Services</h2>
    		<jsp:include page="../common/top-menu.jsp" />
      	</div>
        <div id="wrapper">
        	<div id="content">
              <div id="box">
	            	<h3>Buy Funds</h3>
	            	<jsp:include page="../common/messages.jsp"/>
	            	<p>Available Cash Balance : <b>$<%=Formatter.prepCashToView(Balance.getCustomerAvailableCash(customer)) %></b></p>
	            	<%if((Double)request.getAttribute("cashBalance")>0){ %>
	                <form id="form" action="customerBuyFund.do" method="post" class="user-form">
	                    <label for="txtFundID" class="label-long">Choose Fund : </label>
	                    <select name="txtFundID" tabindex="1">
						<%
						if(request.getAttribute("funds")!= null) {
						    Fund [] tempFunds = (Fund[])request.getAttribute("funds");
						    for (int i = 0; i < tempFunds.length ; i ++){    
						        Fund tempFund = tempFunds[i];
						%>
						  		  	<OPTION VALUE="<%= tempFund.getFundID() %>"><%=tempFund.getName() %></OPTION>
						<%
							}
						} else {    
						%>
						    		<OPTION VALUE="">Fund could not be retrieved</OPTION>
						<%
						}
						%>
						</SELECT>
						<br />
	                    <input type="hidden" name="txtSubmissionDate" size="20" value="${txtSubmissionDate}" readonly />
	                    <br />
	                    <label for="txtAmount" class="label-long">Total Value of Shares to buy : </label>
	                    <input type="text" name="txtAmount" size="20" value="${txtAmount}" tabindex="2"/>
	                    <br />
	                  <div align="center">
	                  <input id="buy-funds" type="submit" name="Submit" value="Send Purchase Order" tabindex="3" /> 
	                  <input id="cancel" type="reset" tabindex="4" value="Cancel" />
	                  </div>
	                </form>
	                <%} %>
	                <div class="create-emp-result"></div>
                </div>

            </div>

            <jsp:include page="../common/sidebar.jsp" />
      </div>
        <jsp:include page="../common/footer.jsp" />
</div>
<div id="popup" ></div>
</body>
</html>
